<template>
	<view class="setting-container">
		<common-head title="共有情况" :autoBack="true"></common-head>
		<view class="dk-head flex-between">
			<text class="label-txt">地块基本信息</text>
			<text class="num-txt">{{baseData.dkbm || '--'}}</text>
		</view>
		<view class="dk-info flex-column">
			<view class="info-item flex-normal">
				<text class="label-txt width">地块名称：</text>
				<text class="val-txt">{{baseData.dkmc || '--'}}</text>
			</view>
			<view class="info-item flex-normal">
				<text class="label-txt width">确权面积：</text>
				<text class="val-txt">{{baseData.htmjm || '--'}}/亩</text>
			</view>
		</view>
		<view class="gydk-list">
			<view class="item flex-column"
			v-for="(item, index) in list">
				<text class="label-txt">共同地块承包方名称：{{item.cbfmc}}</text>
				<text class="val-txt">分摊面积：{{item.htmjm}}/亩</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		queryParams
	} from '@/script/tools.js'
	import { detailCbdk, listCbdkGyqk } from '@/script/api/cbdk/index.js'
	export default {
		data() {
			return {
				routeParam: {},
				baseData: {},
				list: []
			}
		},
		onLoad(e) {
			let _self = this
			_self.routeParam = e
			_self.initPages()
		},
		methods: {
			async initPages(){
				let _self = this
				await _self.getDetailCbdk(_self.routeParam)
				_self.getListCbdkGyqk()
			},
			getListCbdkGyqk(){
				let _self = this
				listCbdkGyqk({
					dkbm: _self.baseData.dkbm
				}).then(res => {
					console.log(res.data)
					_self.list = res.data || []
				})
			},
			async getDetailCbdk(routeParam){
				let _self = this, isSuccess = false
				await detailCbdk(routeParam).then(res => {
					_self.baseData = res.data
					isSuccess = true
				})
				return isSuccess
			},
		}
	}
</script>

<style lang="scss" scoped>
	@mixin fontStyle($color, $size, $weight: 500) {
		color: $color;
		font-size: $size;
		font-weight: $weight;
	}
	.setting-container{
		font-weight: 500;
		min-height: 100vh;
		background: #f8f8f8;
		.dk-head{
			padding: 20rpx 30rpx;
			.label-txt{
				@include fontStyle(#111, 36rpx);
			}
			.num-txt{
				@include fontStyle(#999, 28rpx, 400);
			}
		}
		.dk-info{
			background-color: #fff;
			padding: 20rpx 30rpx;
			.info-item{
				margin-bottom: 30rpx;
				&:last-child{
					margin-bottom: 0
				}
			}
			.label-txt{
				@include fontStyle(#111, 32rpx);
			}
			.val-txt{
				@include fontStyle(#111, 32rpx);
			}
		}
		.gydk-list{
			margin-top: 30rpx;
			padding: 0 30rpx;
			background-color: #fff;
			.item{
				border-bottom: 1rpx solid f4f4f5;
				padding: 20rpx 0;
			}
			.label-txt{
				@include fontStyle(#111, 32rpx);
			}
			.val-txt{
				margin-top: 16rpx;
				@include fontStyle(#111, 32rpx);
			}
		}
	}
</style>
